home *** CD-ROM | disk | FTP | other *** search
-
-
-
- cccclllloooosssseeee((((DDDD2222)))) cccclllloooosssseeee((((DDDD2222))))
-
-
-
- NNNNAAAAMMMMEEEE
- _cccc_llll_oooo_ssss_eeee - relinquish access to a device
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- BBBBlllloooocccckkkk aaaannnndddd CCCChhhhaaaarrrraaaacccctttteeeerrrr SSSSyyyynnnnooooppppssssiiiissss
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ffff_iiii_llll_eeee_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_eeee_rrrr_rrrr_nnnn_oooo_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_oooo_pppp_eeee_nnnn_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_cccc_rrrr_eeee_dddd_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
- _iiii_nnnn_tttt _p_r_e_f_i_x_cccc_llll_oooo_ssss_eeee_((((_dddd_eeee_vvvv______tttt _d_e_v_,,,, _iiii_nnnn_tttt _f_l_a_g_,,,, _iiii_nnnn_tttt _o_t_y_p_,,,, _cccc_rrrr_eeee_dddd______tttt _****_c_r_p_))))_;;;;
-
- BBBBlllloooocccckkkk aaaannnndddd CCCChhhhaaaarrrraaaacccctttteeeerrrr AAAArrrrgggguuuummmmeeeennnnttttssss
- _d_e_v Device number.
-
- _f_l_a_g File status flags.
-
- _o_t_y_p Parameter supplied so that the driver can determine how many
- times a device was opened and for what reasons.
-
- _c_r_p Pointer to the user credential structure.
-
- SSSSTTTTRRRREEEEAAAAMMMMSSSS SSSSyyyynnnnooooppppssssiiiissss
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ssss_tttt_rrrr_eeee_aaaa_mmmm_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ffff_iiii_llll_eeee_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_eeee_rrrr_rrrr_nnnn_oooo_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_cccc_rrrr_eeee_dddd_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
- _iiii_nnnn_tttt _p_r_e_f_i_x_cccc_llll_oooo_ssss_eeee_((((_qqqq_uuuu_eeee_uuuu_eeee______tttt _****_q, _iiii_nnnn_tttt _f_l_a_g, _cccc_rrrr_eeee_dddd______tttt _****_c_r_p_))))_;;;;
-
- SSSSTTTTRRRREEEEAAAAMMMMSSSS AAAArrrrgggguuuummmmeeeennnnttttssss
- _q Pointer to queue used to reference the read side of the driver.
-
- _f_l_a_g File status flag.
-
- _c_r_p Pointer to the user credential structure.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- BBBBlllloooocccckkkk aaaannnndddd CCCChhhhaaaarrrraaaacccctttteeeerrrr DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
- The _cccc_llll_oooo_ssss_eeee routine ends the connection between the user process and the
- device, and prepares the device (hardware and software) so that it is
- ready to be opened again.
-
- Valid values for _f_l_a_g and their definitions can be found in _oooo_pppp_eeee_nnnn(D2).
-
- The values for _o_t_y_p are mutually exclusive:
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- cccclllloooosssseeee((((DDDD2222)))) cccclllloooosssseeee((((DDDD2222))))
-
-
-
- _OOOO_TTTT_YYYY_PPPP______BBBB_LLLL_KKKK Close was through the block interface for the device.
-
- _OOOO_TTTT_YYYY_PPPP______CCCC_HHHH_RRRR Close was through the raw/character interface for the
- device.
-
- _OOOO_TTTT_YYYY_PPPP______LLLL_YYYY_RRRR Close a layered device. This flag is used when one
- driver calls another driver's _cccc_llll_oooo_ssss_eeee routine.
-
- For _OOOO_TTTT_YYYY_PPPP______BBBB_LLLL_KKKK and _OOOO_TTTT_YYYY_PPPP______CCCC_HHHH_RRRR, a device may be opened simultaneously by
- multiple processes and the driver _oooo_pppp_eeee_nnnn routine is called for each open,
- but the kernel will only call the _cccc_llll_oooo_ssss_eeee routine when the last process
- using the device issues a _cccc_llll_oooo_ssss_eeee(2) system call or exits.
-
- There is one exception to this rule. If a device is opened through both
- its character and its block interfaces, then there will be one close per
- interface. For example, if the same device is opened twice through its
- block interface and three times through its character interface, then
- there will be two calls to the driver's close routine; one when the block
- interface is finished being used, and one when the character interface is
- finished being used.
-
- For _OOOO_TTTT_YYYY_PPPP______LLLL_YYYY_RRRR, there will be one such close for every corresponding open.
- Here, the driver should count each open and close based on the _o_t_y_p
- parameter to determine when the device should really be closed.
-
- SSSSTTTTRRRREEEEAAAAMMMMSSSS DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
- The _cccc_llll_oooo_ssss_eeee routines of STREAMS drivers and modules are called when a
- stream is dismantled or a module popped. The steps for dismantling a
- stream are performed in the following order. First, any non-persistent
- multiplexor links present are unlinked and the lower streams are closed.
- Next, the following steps are performed for each module or driver on the
- stream, starting at the head and working toward the tail:
-
- 1. The write queue is given a chance to drain.
-
- 2. Interrupts from STREAMS devices are blocked.
-
- 3. The _cccc_llll_oooo_ssss_eeee routine is called.
-
- 4. The module or driver is removed from the stream.
-
- 5. Any remaining messages on the queues are freed.
-
- RRRReeeettttuuuurrrrnnnn VVVVaaaalllluuuueeeessss
- The _cccc_llll_oooo_ssss_eeee routine should return 0 for success, or the appropriate error
- number. Refer to _eeee_rrrr_rrrr_nnnn_oooo_ssss(D5) for a list of DDI/DKI error numbers. Return
- errors rarely occur, but if a failure is detected, the driver should
- still close the device and then decide whether the severity of the
- problem warrants displaying a message on the console.
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- cccclllloooosssseeee((((DDDD2222)))) cccclllloooosssseeee((((DDDD2222))))
-
-
-
- UUUUSSSSAAAAGGGGEEEE
- This entry point is required in all drivers and STREAMS modules.
-
- A _cccc_llll_oooo_ssss_eeee routine could perform any of the following general functions,
- depending on the type of device and the service provided:
-
- disable device interrupts
-
- hang up phone lines
-
- rewind a tape
-
- deallocate buffers from a private buffering scheme
-
- unlock an unsharable device (that was locked in the _oooo_pppp_eeee_nnnn routine)
-
- flush buffers
-
- notify a device of the close
-
- cancel any pending timeout or bufcall routines that access data that
- are deinitialized or deallocated during close
-
- deallocate any resources allocated on open
-
- SSSSyyyynnnncccchhhhrrrroooonnnniiiizzzzaaaattttiiiioooonnnn CCCCoooonnnnssssttttrrrraaaaiiiinnnnttttssss
- The _cccc_llll_oooo_ssss_eeee routine has user context and can sleep. However, STREAMS
- drivers and modules must sleep such that signals do not cause the sleep
- to longjump [see _ssss_llll_eeee_eeee_pppp(D3)]. Also, if a _cccc_llll_oooo_ssss_eeee routine does sleep, it is
- important that the driver writer synchronize the driver's _oooo_pppp_eeee_nnnn and _cccc_llll_oooo_ssss_eeee
- routines, since a driver can be reopened while being closed.
-
- If the _FFFF_NNNN_DDDD_EEEE_LLLL_AAAA_YYYY or _FFFF_NNNN_OOOO_NNNN_BBBB_LLLL_OOOO_CCCC_KKKK flags are specified in the _f_l_a_g argument, the
- driver should try to avoid sleeping, if possible, during close
- processing.
-
- RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS
- _dddd_rrrr_vvvv______pppp_rrrr_iiii_vvvv(D3), _eeee_rrrr_rrrr_nnnn_oooo_ssss(D5), _oooo_pppp_eeee_nnnn(D2), _qqqq_uuuu_eeee_uuuu_eeee(D4), _uuuu_nnnn_bbbb_uuuu_ffff_cccc_aaaa_llll_llll(D3),
- _uuuu_nnnn_tttt_iiii_mmmm_eeee_oooo_uuuu_tttt(D3), _ssss_llll_eeee_eeee_pppp(D3)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-